package moc.egg;
import moc.compiler.*;
import moc.tds.*;
import moc.type.*;
import moc.gc.*;
import java.util.*;
import mg.egg.eggc.runtime.libjava.lex.*;
import mg.egg.eggc.runtime.libjava.*;
import mg.egg.eggc.runtime.libjava.messages.*;
import mg.egg.eggc.runtime.libjava.problem.IProblem;
import java.util.Vector;
public class S_AFFX_MOC {
LEX_MOC scanner;
  S_AFFX_MOC() {
    }
  S_AFFX_MOC(LEX_MOC scanner, boolean eval) {
    this.scanner = scanner;
    this.att_eval = eval;
    this.att_scanner = scanner;
    }
int [] sync= new int[0];
  DTYPE att_stype;
  boolean att_eval;
  DTYPE att_htype;
  String att_code;
  IMachine att_machine;
  TDS att_tds;
  LEX_MOC att_scanner;
  boolean att_decl;
  private void regle30() throws Exception {

    //declaration
    T_MOC x_2 = new T_MOC(scanner ) ;
    S_A_MOC x_4 = new S_A_MOC(scanner,att_eval) ;
    //appel
if  (att_eval)      action_auto_inh_30(x_4);
    x_2.analyser(LEX_MOC.token_affect);
if  (att_eval)      action_sens_30(x_4);
    x_4.analyser() ;
if  (att_eval)      action_gen_30(x_4);
  }
  private void regle31() throws Exception {

    //declaration
    //appel
if  (att_eval)      action_code_31();
  }
private void action_code_31() throws Exception {
try {
// instructions
this.att_stype=this.att_htype;
if ((this.att_decl)){
this.att_code="PUSH "+this.att_htype.getTaille()+";\n ";
}
else {
this.att_code="";
}
}catch(RuntimeException e) {       att_scanner._interrompre(IProblem.Internal,att_scanner.getBeginLine(),ICoreMessages.id_EGG_runtime_error, CoreMessages.EGG_runtime_error,new Object[] { "MOC", "#code","AFFX -> #code ;"});
}
  }
private void action_gen_30(S_A_MOC x_4) throws Exception {
try {
// instructions
if ((x_4.att_type.equals(this.att_htype))){
this.att_stype=x_4.att_type;
this.att_code=x_4.att_code;
}
else {
att_scanner._interrompre(IProblem.Semantic, att_scanner.getBeginLine(), IMOCMessages.id_Type_non_conformes, MOCMessages.Type_non_conformes,new Object[]{""+x_4.att_type.toString(), ""+this.att_htype.toString()});

}
}catch(RuntimeException e) {       att_scanner._interrompre(IProblem.Internal,att_scanner.getBeginLine(),ICoreMessages.id_EGG_runtime_error, CoreMessages.EGG_runtime_error,new Object[] { "MOC", "#gen","AFFX -> affect #sens A #gen ;"});
}
  }
private void action_sens_30(S_A_MOC x_4) throws Exception {
try {
// instructions
x_4.att_gauche=false;
}catch(RuntimeException e) {       att_scanner._interrompre(IProblem.Internal,att_scanner.getBeginLine(),ICoreMessages.id_EGG_runtime_error, CoreMessages.EGG_runtime_error,new Object[] { "MOC", "#sens","AFFX -> affect #sens A #gen ;"});
}
  }
private void action_auto_inh_30(S_A_MOC x_4) throws Exception {
try {
// instructions
x_4.att_tds=this.att_tds;
x_4.att_machine=this.att_machine;
}catch(RuntimeException e) {       att_scanner._interrompre(IProblem.Internal,att_scanner.getBeginLine(),ICoreMessages.id_EGG_runtime_error, CoreMessages.EGG_runtime_error,new Object[] { "MOC", "#auto_inh","AFFX -> affect #sens A #gen ;"});
}
  }
  public void analyser () throws Exception {
    scanner.lit ( 1 ) ;
    switch ( scanner.fenetre[0].code ) {
      case LEX_MOC.token_affect : // 3858
        regle30 () ;
      break ;
      case LEX_MOC.token_pv : // 3857
        regle31 () ;
      break ;
      case LEX_MOC.token_virg : // 3856
        regle31 () ;
      break ;
      case LEX_MOC.token_parf : // 3853
        regle31 () ;
      break ;
      case LEX_MOC.token_crf : // 3886
        regle31 () ;
      break ;
      default :
               scanner._interrompre(IProblem.Syntax, scanner.getBeginLine(), IMOCMessages.id_MOC_unexpected_token,MOCMessages.MOC_unexpected_token,new String[]{scanner.fenetre[0].getNom()});
    }
  }
  }
